package io.renren.modules.generator.enums;

import org.apache.commons.lang.StringUtils;

/**
 * @ClassName RoleTypeEnum
 * @Description 角色编码对应角色类型
 * @Author zhengd
 * @Date 2020/10/4 22:39
 * @Version 1.0
 **/
public enum RoleTypeEnum {

    role_749411628587417600("role_749411628587417600",1),
    role_749411599457976320("role_749411599457976320",2),
    role_749411559578533888("role_749411559578533888",3),
    OTHER("未知",-1);

    /**
     * 代号
     */
    private int code;

    /**
     * 说明
     */
    private String value;

    RoleTypeEnum(String value,int code){
        this.code = code;
        this.value = value;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static Integer message(String value){
        for (RoleTypeEnum roleTypeEnum : RoleTypeEnum.values()) {
            if (StringUtils.equalsIgnoreCase(roleTypeEnum.getValue(),value)) {
                return roleTypeEnum.getCode();
            }
        }
        return OTHER.getCode();
    }
}
